import Koa from "koa"
import Router from "koa-router"
import bodyparser from "koa-bodyparser"
import cors from "@koa/cors"
import { DB } from "./db/index.js"
import { getControllerUrl, esgController } from "./utils/tools.js"
import { appPort } from "./config/appStting.js"
let app = new Koa()
app.use(cors())
let router = new Router()
let  controllerFiles = getControllerUrl()
esgController(router, controllerFiles)
app.use(bodyparser())
app.use(router.routes())
app.use(router.allowedMethods())

DB()
app.listen(appPort,function () {
    console.log("服务运行http://localhost:5000");
    
})
